<div class="form">


<?php $form = $this->beginWidget('GxActiveForm', array(
	'id' => 'cities-form',
	'enableAjaxValidation' => false,
));
?>

	<p class="note">
		<?php echo AdminModule::t('Поля помеченные '); ?> <span class="required">*</span> <?php echo AdminModule::t('являются обязательными'); ?>.
	</p>

	<?php echo $form->errorSummary($model); ?>

		<div class="row">
		<?php echo $form->labelEx($model,'hidden'); ?>
		<?php echo $form->checkBox($model, 'hidden'); ?>
		<?php echo $form->error($model,'hidden'); ?>
		</div><!-- row -->
		<div class="row">
		<?php echo $form->labelEx($model,'country_id'); ?>
		<?php  
            echo $form->dropDownList($model, 'country_id', GxHtml::listDataEx(Countries::model()->findAllAttributes(null, true)),
            array(
                'ajax' => array(
                    'type'=>'POST', //request type
                    'url'=> $this->createUrl('/admin/default/modelkeyoptions'),
                    'update'=>'#dropdown_regions', //cherez , mojno mnogo peredat
                    'data'=>array('country_id'=>'js:this.value', 'pkey'=>'country_id', 'model'=>'Regions', 'ovkey'=>'id', 'olkey' => 'name', /*'dvkey'=> '', 'dlkey'=>AdminModule::t('All')*/),
                )
            ));

        ?>
		<?php echo $form->error($model,'country_id'); ?>
		</div><!-- row -->
		<div class="row">
		<?php echo $form->labelEx($model,'region_id'); ?>
		<?php 
			$country_id = 0 < $model->country_id ? $model->country_id : Yii::app()->params['default_country_id'];
			echo $form->dropDownList($model, 'region_id', 
				GxHtml::listDataEx(Regions::model()->findAllAttributes(null, true, 'hidden = 0 AND country_id = :cid', array(':cid' => $country_id))), 
				array('id'=>'dropdown_regions')
			);         
        ?>
		<?php echo $form->error($model,'region_id'); ?>
		</div><!-- row -->
		<div class="row">
		<?php echo $form->labelEx($model,'name'); ?>
		<?php echo $form->textField($model, 'name', array('maxlength' => 255)); ?>
		<?php echo $form->error($model,'name'); ?>
		</div><!-- row -->
<?php
echo GxHtml::submitButton(AdminModule::t('Сохранить'));
$this->endWidget();
?>
</div><!-- form -->